import java.util.*;
public class TestDemo {

    /*
    public static void arrayPrint(int[] array) {
            Arrays.toString(array);
        }
    */
    
    /*
    public static int[] copyArray(int[] array) {
        int[] arr = new int[array.length];
        for(int i = 0;i < array.length;i++) {
            arr[i] = array[i];
        }
        return arr;
    }
    */
    /*
    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4};
        /*
        int[] array2 = new int[]{11, 12, 13, 14};
        int[] array3 = new int[4];
        
        for (int i = 0;i < array.length;i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println("");

        for (int i : array) {
            System.out.println(i+" ");
        }
        
        arrayPrint(array);
        int[] array2 = copyArray(array);
        for (int i : array2) {
            System.out.print(i+" ");
        }
        */

        /*
        public static void main(String[] args) {
            
            int[] arr1 = {1,2,3,4,5};
            int[] arr2 = new int[5];
            System.arraycopy(arr1, 0, arr2, 0, arr1.length);
            int[] arr3 = new int[3];
            System.arraycopy(arr1, 2, arr3, 0, 3);
            arr2[1] = 888;
            System.out.println(Arrays.toString(arr1));
            System.out.println(Arrays.toString(arr3));
        }
        */

        /*
        public static int binarySeach(int[]arr ,int l, int r, int value) {

            int mid = 0;
            while (l <= r) {
                mid = (l + r) / 2;
                if (arr[mid] > value) {
                    r = mid - 1;

                } else if (arr[mid] < value) {
                    l = mid + 1;

                } else {
                    break;

                }
            }

            if(l > r) {
                return -1;

            } else {
                return mid;

            }
        }
        public static void main(String[] args) {

            Scanner scan = new Scanner(System.in);
            int[] array = {2,4,6,8,10,12,14};
            int l = 0, r = array.length-1, value = 0;
            value = scan.nextInt();
            scan.close();
            int ret = binarySeach(array, l, r, value);
            if (ret >= 0) {
                System.out.println("Find: " + ret);
            } else {
                System.out.println("not found");
            }
        }
        */
        /*
        public static void main(String[] args) {
             int[] array = {2,4,6,8,10};
             int key = 15, ret = 0;
             ret = Arrays.binarySearch(array,key);
             Arrays.sort(array);
             System.out.println(ret);
        }
        */

        /*
        public static boolean isUp(int[] array) {

            int i = 0;
            for (i = 0;i < array.length -1;i++) {
                if (array[i] > array[i+1]) {
                    break;
                }
            }

            if (i < array.length -1) {
                return false;

            } else {
                return true;
            }
        }
        public static void main(String[] args) {
            int[] array = {1,2,3,8,11};
            boolean ret = isUp(array);
            if (ret) {
                System.out.println("array is up");

            } else {
                System.out.println(("array is not up"));
            }
        }
        */

        /*
        public static void main(String[] args) {
            /*int[][] array = {{1,2,3},{4,5,6}};
            System.out.println(Arrays.deepToString(array));
            

            int[][] array = new int[2][];
            array[0] = new int[] {1,2,4};
            array[1] = new int[] {7,8};
            System.out.println(Arrays.deepToString(array));
        }
        */






        /**
         * 访问修饰限定符
         * public : 共有的  
         * private : 私有的  
         * protected ： 受保护的
         * 什么都不写 ：默认访问权限（包访问权限）
         */
        public static void main1(String[] args) {

            //通过new来实例化一个对象
            Person person1 = new Person();
            Person person2 = new Person();
        }

        public static void main2(String[] args) {
            Person person = new Person();

            //如何访问对象的实例成员变量？ .来访问
            System.out.println(person.name);

        }

        public static void main(String[] args) {
    
            //如何访问静态成员？
            Person person = new Person();

            //如何访问实例成员方法？？
            person.eat();
            person.sleep();

            //person.methoddd();
            Person.methoddd();
        }
        
        
}

class Person {

    //字段->成员变量,定义在类的里面，方法的外面,他就在对象（对象在堆区）里面
    //实例成员变量，在对象里面
    public String name = "垃圾"; 
    public int age;

    public static int size = 20; //静态成员变量

    // 方法->行为  eat()  sleep()都没有加static，所以我们称之为实例成员方法
    public void eat() {
        int a = 10;//局部变量，使用的时候要初始化
        System.out.println("eat()!");
    }

    public  void sleep() {
        System.out.println("sleep()!");
    }

    //静态成员方法
    public static void methoddd() {
        //在静态方法内部不能访问非静态成员变量
        //age = 99;
        //size = 66;

        System.out.println("I`m a static method!!");
    }

    public static void hehe() {
        methoddd();
    }

    /**
     * https://onedrive.live.com/view.aspx?resid=64BC5985E72D1960%21123&id=documents&wd=target%28Java%20SE.one%7C291FC879-0C0C-4709-9CE1-08CED32A604B%2FJAVA_Learning_2_27%7C40442D5B-9732-46CF-8F43-F5712708C56E%2F%29
       onenote:https://d.docs.live.net/64bc5985e72d1960/文档/志轩%20的笔记本/Java%20SE.one#JAVA_Learning_2_27&section-id={291FC879-0C0C-4709-9CE1-08CED32A604B}&page-id={40442D5B-9732-46CF-8F43-F5712708C56E}&end
     * 
     */
}